﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class NineDigitMagicNumbers
{
    static void Main()
    {
        int sum = int.Parse(Console.ReadLine());
        int diff = int.Parse(Console.ReadLine());

        int counter = 0;

        for (int i = 1; i <= 7; i++)
        {
            for (int j = 1; j <= 7; j++)
            {
                for (int k = 1; k <= 7; k++)
                {

                    // Convert each i, j, k to string in order to concatenate them 
                    string a = Convert.ToString(i);
                    string b = Convert.ToString(j);
                    string c = Convert.ToString(k);

                    string abcSumStr = a + b + c;

                    // return back the 3 digit string-number to int-number (it is "abc")
                    int abcSumInt = Convert.ToInt32(abcSumStr);

                    int defSumInt = abcSumInt + diff;
                    int ghiSumInt = defSumInt + diff;

                    string defSumStr = Convert.ToString(defSumInt);
                    string ghiSumStr = Convert.ToString(ghiSumInt);

                    // concatenate the string abcdefghi and convert it to int
                    string numberStr = abcSumStr + defSumStr + ghiSumStr;
                    int numberSum = 0;
                    bool noZero = true;
                    for (int m = 0; m < numberStr.Length; m++)
                    {
                        if (numberStr[m] == '0' || numberStr[m] == '9' || numberStr[m] == '8' ||
                            numberStr.Length > 9)
                        {
                            noZero = false;
                        }
                        int digit = 0;
                        switch (numberStr[m])
                        {
                            case '1':
                                digit = 1;
                                break;
                            case '2':
                                digit = 2;
                                break;
                            case '3':
                                digit = 3;
                                break;
                            case '4':
                                digit = 4;
                                break;
                            case '5':
                                digit = 5;
                                break;
                            case '6':
                                digit = 6;
                                break;
                            case '7':
                                digit = 7;
                                break;
                        }
                        numberSum += digit;
                    }

                    // check the sum and print if equal
                    if (noZero && numberSum == sum)
                    {
                        Console.WriteLine("{0}", numberStr);
                        counter++;
                    }
                }
            }
        }
        if (counter == 0)
        {
            Console.WriteLine("No");
        }
    }
}